package com.kanshu.ksgb.fastread.doudou.module.book.retrofit;

import com.kanshu.ksgb.fastread.doudou.common.business.commonbean.BookInfo;
import com.kanshu.ksgb.fastread.doudou.common.net.bean.BaseResult;
import com.kanshu.ksgb.fastread.doudou.common.net.retrofit.FormObjConverterFactory;
import com.kanshu.ksgb.fastread.doudou.common.net.retrofit.Obj;
import com.kanshu.ksgb.fastread.doudou.common.share.ShareBean;
import com.kanshu.ksgb.fastread.doudou.module.book.bean.ChapterBean;
import com.kanshu.ksgb.fastread.doudou.module.book.bean.DeleteBookBean;
import com.kanshu.ksgb.fastread.doudou.module.book.bean.ShakeBean;
import com.kanshu.ksgb.fastread.doudou.module.book.bean.SimpleChapterBean;
import com.kanshu.ksgb.fastread.doudou.module.book.retrofit.requestparams.BookPageParams;
import com.kanshu.ksgb.fastread.doudou.module.book.retrofit.requestparams.ChapterRequestParams;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * Created by wcy on 2017\5\8 0008.
 */

public interface BookService {
    // 获取章节内容信息
    @GET("app/chapter/content")
    Observable<BaseResult<ChapterBean>> getChapterContent(@Query(value = FormObjConverterFactory.PLACEHOLDER) @Obj ChapterRequestParams params);

    // 获取章节列表数据
    @GET("app/chapter/lists")
    Observable<BaseResult<List<ChapterBean>>> getChapterList(@Query(value = FormObjConverterFactory.PLACEHOLDER) @Obj BookPageParams params, @Query("get_user_is_buy") String get_user_is_buy);

    // 告诉后台读到哪一章阅读内容
    @GET("app/chapter/adduserread")
    Call<ResponseBody> notifyServerReadedChapter(@Query(value = FormObjConverterFactory.PLACEHOLDER) @Obj ChapterRequestParams params);

    // 章节分享内容
    @GET("app/chapter/shareinfo")
    Observable<BaseResult<ShareBean>> getChapterShareInfo(@Query(value = FormObjConverterFactory.PLACEHOLDER) @Obj ChapterRequestParams params);

    // 所有章节简单信息
    @GET("app/chapter/allchapters")
    Observable<BaseResult<List<SimpleChapterBean>>> getAllSimpleChapters(@Query("book_id") String book_id);

    // 简单的章节信息
    @GET("app/chapter/contentinfo")
    Observable<BaseResult<SimpleChapterBean>> getSimpleChapterInfo(@Query("book_id") String book_id, @Query("order") String order);

    @FormUrlEncoded
    @POST("yd/comment/add")
    Call<ResponseBody> submit(@FieldMap Map<String, String> map);

    // 加入书架
    @GET("app/bookcase/add")
    Observable<BaseResult<BookInfo>> joinBookShelf(@Query("book_id") String book_id);

    // 从书架中删除
    @GET("app/bookcase/del")
    Observable<BaseResult<DeleteBookBean>> delFromBookShelf(@Query("book_id") String book_id);

    // 用户阅读行为时间上报
    @FormUrlEncoded
    @POST("app/userreadaction/add")
    Call<ResponseBody> upLoadUserReadaction(@Field("book_id") String book_id, @Field("content_id") String content_id, @Field("page_num") String page_num, @Field("read_consume_time") String read_consume_time);

    //阅读器尾页-猜你喜欢
    @GET("app/book/like")
    Observable<BaseResult<List<BookInfo>>> getBookLike(@Query("category_id_1") String category_id_1);

    //更新书籍通知-查询
    @GET("app/userbooknotice/one")
    Observable<BaseResult<ShakeBean>> queryUpdateBook(@Query("book_id") String book_id);

    //更新书籍通知-添加
    @FormUrlEncoded
    @POST("app/userbooknotice/add")
    Call<ResponseBody> addBookUpdate(@Field("book_id") String book_id);

    //更新书籍通知-删除
    @FormUrlEncoded
    @POST("app/userbooknotice/del")
    Call<ResponseBody> delBookUpdate(@Field("book_id") String book_id);

    //获取摇一摇的书籍
    @GET("app/morebook/applists")
    Observable<BaseResult<List<BookInfo>>> getShakeBook(@Query("type_name") String type_name, @Query("sex") String sex);

}
